import Vue from 'vue'
Vue.directive('recommend',{
    bind(el,bindings){
        //创建DOM元素
        let recommendDiv=document.createElement('div')
        //设置宽度
        recommendDiv.style.width=0
        recommendDiv.style.height=0
        //设置四边的样式
        recommendDiv.style.borderTop="20px solid #FFC300"
        recommendDiv.style.borderLeft=" 20px solid transparent"
        recommendDiv.style.borderBottom=" 20px solid transparent"
        recommendDiv.style.borderRight="20px solid #FFC300"
        //设置postion
        recommendDiv.style.position="absolute"
        recommendDiv.style.right=0
        //创建span元素
        let spanEle=document.createElement('span')
        spanEle.style.position="absolute"
        spanEle.innerText="力推"
        spanEle.style.color="#fff"
        spanEle.style.transform="rotate(45deg)"
        spanEle.style.width="40px"
        spanEle.style.height="15px"
        spanEle.style.top="-10px"
        spanEle.style.right="-32px"
        spanEle.style.fontFamily="华文琥珀"
        spanEle.style.fontSize="10px"
        recommendDiv.appendChild(spanEle)
        el.appendChild(recommendDiv)
    }
})